<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .text_class {
            color: deepskyblue;
        }

        .bgc {
            background-color: palevioletred;
        }
    </style>
</head>

<body>
    <div id="app">
        <a :href="url">百度</a>
        <!-- 绑定class -->
        <p class="text_class bgc">文字蓝色</p>

        <!-- 绑定一个 -->
        <p :class="tc">文字蓝色</p>
        <!-- 绑定多个使用数组用逗号隔开 -->
        <p :class="[tc,bc]">文字蓝色</p>
        <!-- 用对象的方式绑定 -->
        <p :class="{text_class:true,bgc:true}">千束</p>
        <!-- es6属性名表达式 -->
        <p :class="{[tc]:true,[bc]:true}">千束</p>

    </div>
</body>
<script src="../vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                url: "http://www.baidu.com",
                tc: "text_class",
                bc: "bgc"
            }
        }
    })
</script>

</html>